package top.csjss.hospital.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.csjss.hospital.entity.Report;
import top.csjss.hospital.entity.ReportExample;

public interface ReportMapper {
    long countByExample(ReportExample example);

    int deleteByExample(ReportExample example);

    int deleteByPrimaryKey(Integer reportId);

    int insert(Report record);

    int insertSelective(Report record);

    List<Report> selectByExample(ReportExample example);

    Report selectByPrimaryKey(Integer reportId);

    int updateByExampleSelective(@Param("record") Report record, @Param("example") ReportExample example);

    int updateByExample(@Param("record") Report record, @Param("example") ReportExample example);

    int updateByPrimaryKeySelective(Report record);

    int updateByPrimaryKey(Report record);

    @Select("select count(0) from report where DATE_FORMAT(time,'%Y-%m-%d')= DATE_FORMAT(now(),'%Y-%m-%d') and state != 0")
    long findReportCountByCurrent();

    /**
     * 查询病人
     *
     * @param cc
     * @param name
     * @return
     */
    List<Report> findPatientInfo(@Param("cc") Integer cc, @Param("name") String name);

    /**
     * 查询指定字段的值是否重复
     *
     * @param column 字段
     * @param value  值
     * @return
     */
    @Select("select count(0) from report where ${column} = #{value} and state in (1,2,3)")
    int checkExists(@Param("column") String column, @Param("value") String value);

    /**
     * 处方划价-查询患者信息
     * @param name
     * @return
     */
    List<Report> findPrescriptionInfo(String name);
}
